package com.cc.factory;
public class RedPig extends Pig {
    private int age;
    private String name;
//    private Foot foot;
    public RedPig() {
       System.out.println("调用了RedPig的构造方法");
    }
    
    
      public RedPig( String name,int age) {
          super();
          this.age = age;
          this.name = name;
    }
    //通过构造法注入属性值
    public RedPig(int  age, String name) {
        super();
        this.age = age;
        this.name = name;
    }
    

    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Override
    public String toString() {
        return "RedPig [age=" + age + ", name=" + name + "]";
    }
  
    
}

    
    
    
    
    
    
    
    
    
    
    
    
    
